package cn.seqdata.jackson;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;

public class LongSerializer extends StdSerializer<Long> {
	private static final long serialVersionUID = 1L;

	public LongSerializer() {
		super(Long.class);
	}

	@Override
	public void serialize(Long value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
		if (null != value) {
			jgen.writeString(Long.toString(value));
		} else {
			jgen.writeNull();
		}
	}
}